#pragma once

#include <boost/thread/thread.hpp>
#include <boost/ptr_container/ptr_list.hpp>
#include <boost/shared_ptr.hpp>
#include "OrbitElemTransform.h"
#include "ApproachTrace.h"

typedef auto_ptr<boost::thread> apBoostThread;

class CApproachCalcThread
{
public:
	CApproachCalcThread(CAsteroidOrbitParam::Ptr pAsteroidOrbitParam, IApproachHolder *pApproachHolder);
	~CApproachCalcThread();

	void Wait();
	bool IsDone(int nWaitMilliSec);
	LPCTSTR GetErrorStr() const;
protected:
	void do_work();
protected:
	apBoostThread				m_pThread;
	CStdString					m_strError;

	CAsteroidOrbitParam::Ptr	m_pAsteroidOrbitParam;
	IApproachHolder	*			m_pApproachHolder;
};

typedef boost::ptr_list<CApproachCalcThread> ListPtr_CApproachCalcThread;
